<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button>停止定时器</button>
<script>
        var time = setTimeout(function () {
            console.log('111')
        },1500);
        var btn = document.querySelector('button');
        btn.addEventListener('click',function () {
            clearTimeout(time);
        });
        var times = setInterval(function () {
            console.log('555')
        },1000);
        btn.addEventListener('click',function () {
            clearInterval(times);
        })
</script>
</body>
</html>